package sctu.edu.java.year2016.team08.chenruixiu.day20160521.chapter5_3;

/**编写Java程序，创建二维数组arr[][],将二维数组中所有元素的和输出
 * Created by Administrator on 2016/5/21.
 */
public class Three {
    public static void main(String[] args) {
        int sum = 0;
        int a[][] = {{1, 2, 3}, {4, 5, 6}};
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++)
                System.out.print(a[i][j] + " ");
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {

                sum = sum + a[i][j];
            }
            System.out.println(sum);

        }


    }
}
